﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;


/// <summary>
/// TLogInfo 的摘要说明
/// </summary>
public class TLogInfo :TData
{
    //常量
  	const string CTableName="t_log_info";
    const string CKeyName = "id";
    //与数据表字段对应的变量
    private string FId ; 
    private DateTime FInTime ; 
    private int FIId ; 
    private string FTitle ; 
    private string FTypeId ; 
    private string FContent ; 
    private int FAuthority ; 
    private string FUrl ; 
    private int FIsOpen ; 
    private decimal FSortNum ; 
    private string FInMan ;
    private int FStatus; 
    
	public TLogInfo()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//

        FTableName = CTableName;
        FKeyName = CKeyName;
	}
    public TLogInfo(string sid)
    {
    	FTableName = CTableName;
        FKeyName = CKeyName;
        FKeyValue = sid;
    }

    public override void Select()
    {
    	string strSql=GetSelectString();
    	TSqlDB oDB=new TSqlDB(strSql);
    	if(!oDB.EOF)
    	{
    		
            FId = oDB["id"].ToString();
            FInTime = oDB["intime"].ToDateTime();
            FIId = oDB["iid"].ToInt();
            FTitle = oDB["title"].ToString();
            FTypeId = oDB["typeid"].ToString();
            FContent = oDB["content"].ToString();
            FAuthority = oDB["authority"].ToInt();
            FUrl = oDB["url"].ToString();
            FIsOpen = oDB["isopen"].ToInt();
            FSortNum = oDB["sortnum"].ToDecimal();
            FStatus = oDB["status"].ToInt();
            FInMan = oDB["inman"].ToString();
    	}
    	oDB.Free();
    }
    //插入新记录。
    public void Insert()
    {
        string ExSql = "'" + FId + "','" + FTitle + "','" + FTypeId + "','" + FContent + "'," + FAuthority + ",'" + FUrl + "'," + FIsOpen + "," + FStatus + "," + FSortNum + ",'" + FInMan + "','" + FInTime + "'";
    	base.Insert(ExSql);
    }
    //更新记录。
    public void Update()
    {
        string ExSql = " intime ='" + FInTime + "', title ='" + FTitle + "', typeid ='" + FTypeId + "', content ='" + FContent + "', authority =" + FAuthority + ", url ='" + FUrl + "', isopen =" + FIsOpen + ",status =" + FStatus + ", sortnum =" + FSortNum + ", inman ='" + FInMan + "'"; 
    	base.Update(ExSql);
    }
    //改变状态,0=未验证,1=已通过验证
    public void Update_status()
    {
        string ExSql = "status=" + FStatus.ToString(); ;
        base.Update(ExSql);
    }
    //静态，可以不用创建对象即可调用。
    public static void DeleteByID(string sID)
    {
        TData.DeleteByID(sID, CTableName, CKeyName);
    }
    
         
    public string Id
    {
        get
        {
            return FId;
        }
        set
        {
            FId = value;
        }
  } 
    public DateTime InTime
    {
        get
        {
            return FInTime;
        }
        set
        {
            FInTime = value;
        }
  } 
    public int IId
    {
        get
        {
            return FIId;
        }
        set
        {
            FIId = value;
        }
  } 
    public string Title
    {
        get
        {
            return FTitle;
        }
        set
        {
            FTitle = value;
        }
  } 
    public string TypeId
    {
        get
        {
            return FTypeId;
        }
        set
        {
            FTypeId = value;
        }
  } 
    public string Content
    {
        get
        {
            return FContent;
        }
        set
        {
            FContent = value;
        }
  } 
    public int Authority
    {
        get
        {
            return FAuthority;
        }
        set
        {
            FAuthority = value;
        }
  } 
    public string Url
    {
        get
        {
            return FUrl;
        }
        set
        {
            FUrl = value;
        }
  } 
    public int IsOpen
    {
        get
        {
            return FIsOpen;
        }
        set
        {
            FIsOpen = value;
        }
  } 
    public decimal SortNum
    {
        get
        {
            return FSortNum;
        }
        set
        {
            FSortNum = value;
        }
  } 
    public string InMan
    {
        get
        {
            return FInMan;
        }
        set
        {
            FInMan = value;
        }
  }
    public int Status
    {
        get
        {
            return FStatus;
        }
        set
        {
            FStatus = value;
        }
    }

}
